package utils

import (
	"os"
	"path/filepath"
)

type GlobalCache struct {
	DbPath string
}

var cache *GlobalCache

func GetDbPath() string {
	root := filepath.Dir(os.Args[0])
	return root + "/config/app.db"
}

func GetInstance() *GlobalCache {
	if cache == nil {
		cache = &GlobalCache{
			DbPath: GetDbPath(),
		}
	}
	return cache
}
